package com.whmskj.xjlhsc.mobie.ProductionManagement.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.whmskj.xjlhsc.controller.vo.Result;
import com.whmskj.xjlhsc.mobie.ProductionManagement.pojo.dto.OutputEnergyConsumptionByShiftDTO;
import com.whmskj.xjlhsc.mobie.ProductionManagement.service.imp.OutputEnergyConsumptionServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;
import java.time.YearMonth;

/**
 * @author jiaruchun
 * @date 2025-08-30 15:37
 */
@SaIgnore
@RestController
@Api(tags = "产量能耗接口")
@RequestMapping("/mobile/ProductionManagement/OutputEnergyConsumption")
public class OutputEnergyConsumptionController {

    @Autowired
    private OutputEnergyConsumptionServiceImpl outputEnergyConsumptionService;
    @GetMapping("/day")
    public Result getOutputEnergyConsumption(@RequestParam("process") String process,
                                             @RequestParam("time") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate time){
        return Result.success(outputEnergyConsumptionService.getOutputEnergyConsumption(process,time));
    }
    @PostMapping("/shift")
    public Result getOutputEnergyConsumptionByShift(@RequestBody OutputEnergyConsumptionByShiftDTO outputEnergyConsumptionByShiftDTO){
        return Result.success(outputEnergyConsumptionService.getOutputEnergyConsumptionByShift(outputEnergyConsumptionByShiftDTO));
    }

    @GetMapping("/month")
    public Result getOutputEnergyConsumptionByMonth(@RequestParam("process") String process,
                                                    @RequestParam("monthStr") String monthStr){
        return Result.success(outputEnergyConsumptionService.getOutputEnergyConsumptionByMonth(process,monthStr));
    }

    @GetMapping("/variety")
    public Result getEnergyConsumptionOfFineSandProductionListByVariety(@RequestParam("monthStr") String monthStr,
                                                                       @RequestParam("process") String process) {
        return Result.success(outputEnergyConsumptionService.getEnergyConsumptionOfFineSandProductionListByVariety(monthStr,process));
    }
}
